package com.lab.lang;

import java.lang.Character.UnicodeBlock;

public class LangUtils {

    private LangUtils() {}

    public static boolean isChinese(String str) {
        char[] charArray = str.toCharArray();

        for (char c : charArray) {
            if (Character.UnicodeBlock.of(c) != UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS) {
                return false;
            }
        }

        return true;
    }

    public static boolean containsChinese(String str) {
        char[] charArray = str.toCharArray();

        for (char c : charArray) {
            if (Character.UnicodeBlock.of(c) == UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS) {
                return true;
            }
        }

        return false;
    }

}
